$aceSites = get-aadsitelink | select cn,Cost,replInterval,sitelist

$newSiteLinkArray = @()

foreach ($aceSite in $aceSites) {
	if($aceSite.siteList.count -gt 1){
		$aceSite | Add-Member -Name SiteLink1 -Value $aceSite.siteList[0] -MemberType NoteProperty
		$aceSite | Add-Member -Name SiteLink2 -Value $aceSite.siteList[1] -MemberType NoteProperty
		$aceSite | Add-Member -Name SiteLink3 -Value $aceSite.siteList[2] -MemberType NoteProperty
	} else {
		$aceSite | Add-Member -Name SiteLink1 -Value $aceSite.siteList -MemberType NoteProperty
		$aceSite | Add-Member -Name SiteLink2 -Value "" -MemberType NoteProperty
		$aceSite | Add-Member -Name SiteLink3 -Value "" -MemberType NoteProperty
	}
	$newSiteLinkArray += $aceSite
}

$newSiteLinkArray |  select cn,Cost,replInterval,SiteLink1,SiteLink2,Sitelink3 | export-csv c:\ACE-SiteLinks.csv -notype